<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <h:form id="alunoSearch" styleClass="edit">
    
        <rich:simpleTogglePanel label="#{messages['application.label.searchParameters']}" switchType="ajax">
        
            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">#{messages['application.aluno.label.ra']}</ui:define>
                <h:inputText id="numRa" value="#{alunoList.aluno.numRa}" size="10" maxlength="10" />
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">#{messages['application.aluno.label.nome']}</ui:define>
                <h:inputText id="nomAluno" value="#{alunoList.aluno.nomAluno}" size="50" maxlength="50" />
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">#{messages['application.aluno.label.rg']}</ui:define>
                <h:inputText id="numRg" value="#{alunoList.aluno.numRg}" size="9" maxlength="9" />
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">#{messages['application.aluno.label.cpf']}</ui:define>
                <h:inputText id="numCpf" value="#{alunoList.aluno.numCpf}" size="11" maxlength="11" />
            </s:decorate>

        
        </rich:simpleTogglePanel>
        
        <div class="actionButtons">
            <h:commandButton id="search" value="#{messages['application.label.search']}" action="/AlunoList.xhtml"/>
        </div>
        
    </h:form>
    
    <rich:panel>
        <f:facet name="header">#{messages['application.label.searchResults']}</f:facet>
    <div class="results" id="alunoList">

    <h:outputText value="#{messages['application.aluno.empty']}" 
               rendered="#{empty alunoList.resultList}"/>
               
    <rich:dataTable id="alunoList" 
                var="aluno"
              value="#{alunoList.resultList}" 
           rendered="#{not empty alunoList.resultList}">
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.aluno.label.ra']} #{alunoList.order=='numRa asc' ? messages.down : ( alunoList.order=='numRa desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{alunoList.order=='numRa asc' ? 'numRa desc' : 'numRa asc'}"/>
                </s:link>
            </f:facet>
            #{aluno.numRa}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.aluno.label.nome']} #{alunoList.order=='nomAluno asc' ? messages.down : ( alunoList.order=='nomAluno desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{alunoList.order=='nomAluno asc' ? 'nomAluno desc' : 'nomAluno asc'}"/>
                </s:link>
            </f:facet>
            #{aluno.nomAluno}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.aluno.label.rg']} #{alunoList.order=='numRg asc' ? messages.down : ( alunoList.order=='numRg desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{alunoList.order=='numRg asc' ? 'numRg desc' : 'numRg asc'}"/>
                </s:link>
            </f:facet>
            #{aluno.numRg}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.aluno.label.cpf']} #{alunoList.order=='numCpf asc' ? messages.down : ( alunoList.order=='numCpf desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{alunoList.order=='numCpf asc' ? 'numCpf desc' : 'numCpf asc'}"/>
                </s:link>
            </f:facet>
            <h:outputText value="#{aluno.numCpf}">
            	<f:convertNumber pattern="000.000.000-00" />
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.aluno.label.nascimento']} #{alunoList.order=='datNascimento asc' ? messages.down : ( alunoList.order=='datNascimento desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{alunoList.order=='datNascimento asc' ? 'datNascimento desc' : 'datNascimento asc'}"/>
                </s:link>
            </f:facet>
            <h:outputText value="#{aluno.datNascimento}">
            	<f:convertDateTime pattern="dd/MM/yyyy" />
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">#{messages['application.label.action']}</f:facet>
            <s:link view="/#{empty from ? 'Aluno' : from}.xhtml" 
                   value="#{messages['application.label.select']}" 
                      id="aluno">
                <f:param name="alunoIdtAluno" 
                        value="#{aluno.idtAluno}"/>
            </s:link>
        </h:column>
    </rich:dataTable>

    </div>
    </rich:panel>
    
    <div class="tableControl">
      
        <s:link view="/AlunoList.xhtml" 
            rendered="#{alunoList.previousExists}" 
               value="#{messages.left}#{messages.left} #{messages['application.label.first']}"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/AlunoList.xhtml" 
            rendered="#{alunoList.previousExists}" 
               value="#{messages.left} #{messages['application.label.previous']}"
                  id="previousPage">
            <f:param name="firstResult" 
                    value="#{alunoList.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/AlunoList.xhtml" 
            rendered="#{alunoList.nextExists}" 
               value="#{messages['application.label.next']} #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult" 
                    value="#{alunoList.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/AlunoList.xhtml" 
            rendered="#{alunoList.nextExists}" 
               value="#{messages['application.label.last']} #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult" 
                    value="#{alunoList.lastFirstResult}"/>
        </s:link>
        
    </div>
    
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/AlunoEdit.xhtml"
                    id="create" 
                 value="#{messages['application.label.create']}">
            <f:param name="alunoIdtAluno"/>
        </s:button>
    </s:div>
    
</ui:define>

</ui:composition>

